var ame = 1;
function AddRow() {
    //添加一行
    var i = tab1.rows.length;
    var Nam = "'div1'";
    var Cod = "fuJ" + i;
    var newTr = tab1.insertRow();
    //添加列
    var newTd0 = newTr.insertCell();
    var newTd1 = newTr.insertCell();
    var newTd2 = newTr.insertCell();
    var newTd3 = newTr.insertCell();
    //设置列内容和属性
    ame++;
    newTd0.innerHTML = '<input type="checkbox" id="box1" onClick="GetRow()"/ /><span id="fuJ1">' + ame + "</span>";
    newTd1.innerHTML = '<input type="text" name="username"/>';
    newTd2.innerHTML = '<input type="text" name="password"/>';
    newTd3.innerHTML = '<input type="text" name="name"/>';
}
function DelRow() {
//删除一行
    var shu = 0;
    var cheCou = document.all("box1");
    for (var i = 0; i < cheCou.length; i++) {
        if (cheCou[i].checked == true) {
            shu++;
        }
    }
    if (shu == cheCou.length) {
        alert('最少要添加一条信息');
        return;
    }
    else if (shu == 0) {
        alert('请选择你要删除的信息');
        return;
    }
    else if (shu == 1) {
        for (var i = 0; i < cheCou.length; i++) { 
            if (cheCou[i].checked == true) {
                tab1.deleteRow(i + 1);
            }
        }
    }
    else if (shu > 1) {
        for (var a = 0; a < shu; a++) {
            for (var i = 0; i < cheCou.length; i++) {
                if (cheCou[i].checked == true) {
                    tab1.deleteRow(i + 1);
                    break;
                }
            }
        }
    }
}
function GetRow() {
    cGetRow = window.event.srcElement.parentElement.parentElement.rowIndex;
}